﻿var page = {
    temperature: 0,
    time_min: 0,
    time_sec: 0,
    effect: 0,
    /* 此方法在第一次显示窗体前发生 */
    onLoad: function (event) {
        console.dir(event)
    },

    /* 此方法展示窗体后发生 */
    onResume: function (event) {

    },

    /* 当前页状态变化为显示时触发 */
    onShow: function (event) {

    },

    /* 当前页状态变化为隐藏时触发 */
    onHide: function (event) {

    },

    /* 此方法关闭窗体前发生 */
    onExit: function (event) {

    },

    onBack: function (event) {
        pm.navigateBack();
    },

    onWheel: function (event) {
        console.log(event);
        switch (event.target.id) {
            case "temperature":
                this.temperature = event.detail.value * 10;
                console.log("this.temperature : " + this.temperature);
                break;
            case "time_min":
                this.time_min = event.detail.value;
                console.log("this.time_min : " + this.time_min)
                break;
            case "time_sec":
                this.time_sec = event.detail.value;
                console.log("this.time_sec : " + this.time_sec)
                break;
        }
    },

    onBtn: function (event) {
        console.log(event);
        switch (event.target.id) {
            case "clean":
                console.log("clean start");
                this.temperature = 0;
                this.time_min = 0;
                this.time_sec = 0;
                this.setData({ temperature: { value: 0 } });
                this.setData({ time_min: { value: 0 } });
                this.setData({ time_sec: { value: 0 } });
                console.log("clean end");
                break;
            case "start":
                pm.redirectTo({
                    url: "startWork/startWork",
                    value: {
                        temperature: this.temperature,
                        time: this.time_min * 60 + this.time_sec,
                    }
                });
                break;
        }
    },
};

Page(page);

page = 0;
